define(function (require, exports, module) {   
    var MainView = require("./views/MainView");
    
    var PluginMng = {};
    
    _.extend(PluginMng, {       
    })
    
    _.extend(PluginMng, Backbone.Events);    
    
    PluginMng.on("SetCurrentTool", function(folder, pluginName){        
        require.async("./plugins/$1/$2Plugin".replace("$1", folder).replace("$2", pluginName), function(Plugin){
    'use strict';
          if (MainView.current.toolHandler){
              MainView.current.toolHandler.destructor();             
          }        
          MainView.current.toolHandler = Plugin.createToolHandler({el: MainView.current.pdfDocView.el});
        });    
    });
    
    module.exports = PluginMng;
})